﻿using System;
using System.Collections.Generic;
using System.Text;

namespace RaisingStudio.Data.Expressions
{
    [Serializable]
    public class QueryExpression : IQueryExpression
    {
        private TableExpression table;
        public TableExpression Table
        {
            get { return table; }
            set { table = value; }
        }

        private ConditionExpression condition;
        public ConditionExpression Condition
        {
            get { return condition; }
            set { condition = value; }
        }

        private ColumnExpressionCollection columns;
        public ColumnExpressionCollection Columns
        {
            get { return columns; }
            set { columns = value; }
        }

        public QueryExpression()
        {
        }

        public QueryExpression(TableExpression table)
        {
            this.table = table;
        }

        public QueryExpression(ConditionExpression condition)
        {
            this.condition = condition;
        }

        public QueryExpression(TableExpression table, ConditionExpression condition)
        {
            this.table = table;
            this.condition = condition;
        }

        public QueryExpression(TableExpression table, ConditionExpression condition, ColumnExpressionCollection columns)
        {
            this.table = table;
            this.condition = condition;
            this.columns = columns;
        }
    }

    [Serializable]
    public class QueryExpression<T> : RaisingStudio.Data.Expressions.QueryExpression, RaisingStudio.Data.Expressions.IQueryExpression<T>
    {
        public QueryExpression()
        {

        }

        public QueryExpression(TableExpression table) : base(table)
        {

        }

        public QueryExpression(ConditionExpression condition) : base(condition)
        {

        }

        public QueryExpression(TableExpression table, ConditionExpression condition) : base(table, condition)
        {

        }

        public QueryExpression(TableExpression table, ConditionExpression condition, ColumnExpressionCollection columns) : base(table, condition, columns)
        {

        }

        private T value;
        public T Value
        {
            get { return this.value; }
            set { this.value = value; }
        }

        public QueryExpression(T value)
        {
            this.value = value;
        }

        public QueryExpression(T value, TableExpression table) : base(table)
        {
            this.value = value;
        }

        public QueryExpression(T value, ConditionExpression condition) : base(condition)
        {
            this.value = value;
        }

        public QueryExpression(T value, TableExpression table, ConditionExpression condition) : base(table, condition)
        {
            this.value = value;
        }

        public QueryExpression(T value, TableExpression table, ConditionExpression condition, ColumnExpressionCollection columns) : base(table, condition, columns)
        {
            this.value = value;
        }
    }
}
